extends Node2D

@export var slime_scene : PackedScene
@export var timer : Timer
@export var score_label : Label
@export var gameover_label : Label

var score : int = 0

# Called when the node enters the scene tree for the first time.
func _ready() -> void:
	pass # Replace with function body.


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
	timer.wait_time -= 0.2 * delta
	timer.wait_time = clamp(timer.wait_time, 1, 3)
	
	score_label.text = "Score : " + str(score)


func _on_timer_timeout() -> void:
	var slime = slime_scene.instantiate()
	slime.position = Vector2(260, randf_range(50, 115))
	get_tree().current_scene.add_child(slime)
	
func show_game_over() -> void:
	gameover_label.visible = true
